import java.io.FileWriter;
import java.io.Writer;

public class FileWriterDemo {

    public static void main(String[] args) {

        try(Writer writer=new FileWriter("D:/temp/java.txt")){
            //对D:/temp/java.txt写入我爱学java!
            writer.write("我爱学java!");
        }catch(Exception e){
            e.printStackTrace();

        }
    }
}
